home *** CD-ROM | disk | FTP | other *** search
- <?
-
- $lmphp4 = "php4/sapi/php4apache.dll";
- $lmphp5 = "php/php5apache.dll";
- $uphp4 = "AddModule mod_php4.c";
- $uphp5 = "AddModule mod_php5.c";
- $mphp4 = "php4_module";
- $mphp5 = "php5_module";
-
- $phpinifile = "../apache/php.ini";
-
-
-
- $myhttpd = @file_get_contents("../apache/conf/httpd.conf") or die ("
- fichier httpd.conf non trouve
- ");
- echo("
- Please wait while stopping Apache service...");
- exec ("NET STOP WAMPAPACHE");
-
- if (eregi($lmphp4,$myhttpd))
- {
- $version = 4;
- $myhttpd = ereg_replace ($lmphp4,$lmphp5,$myhttpd);
- $myhttpd = ereg_replace ($uphp4,$uphp5,$myhttpd);
- $myhttpd = ereg_replace ($mphp4,$mphp5,$myhttpd);
- rename ("../apache/php.ini","../apache/php4.ini");
- rename ("../apache/php5.ini","../apache/php.ini");
- echo("
- Switching from PHP4 to PHP5...
- ");
- }
- else
- {
- $version = 5;
- $myhttpd = ereg_replace ($lmphp5,$lmphp4,$myhttpd);
- $myhttpd = ereg_replace ($uphp5,$uphp4,$myhttpd);
- $myhttpd = ereg_replace ($mphp5,$mphp4,$myhttpd);
- rename ("../apache/php.ini","../apache/php5.ini");
- rename ("../apache/php4.ini","../apache/php.ini");
- echo("
- Switching from PHP5 to PHP4...
- ");
- }
-
- $fp = fopen("../apache/conf/httpd.conf","w");
- fwrite($fp,$myhttpd);
- echo ("Please wait while restarting Apache service...");
- exec ("NET START WAMPAPACHE");
-
- $mywampini = @file_get_contents("../wampserver.ini") or die ("
- fichier httpd.conf non trouve
- ");
- if ($version == 5)
- $mywampini = ereg_replace ("Switch to PHP4","Switch to PHP5",$mywampini);
- else
- $mywampini = ereg_replace ("Switch to PHP5","Switch to PHP4",$mywampini);
- $fp2 = fopen("../wampserver.ini","w");
- fwrite($fp2,$mywampini);
-
- ?>
-